package com.itheima.springbootwebtest.context;

/**
 * 获取当前线程绑定的请求对象
 *
 * @Author mr.luo
 * @Date 14 4月 2025 18:48
 */
public class BaseContext {
    private static ThreadLocal<Integer> threadLocal = new ThreadLocal<>();
    //设置当前线程绑定的请求对象
    public static void setThreadLocal(Integer id) {
        threadLocal.set(id);
    }

    //获取当前线程绑定的请求对象
    public static Integer getThreadLocal() {
        return threadLocal.get();
    }

    //清除当前线程绑定的请求对象
    public static void removeThreadLocal() {
        threadLocal.remove();
    }
}
